<!DOCTYPE html>

<html class="no-js">

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <title></title>
  <meta name="description" content="" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <script src="https://cdn.staticfile.org/axios/0.19.0-beta.1/axios.js"></script>
  <script src="../../cdn/vue/vue.global.min.js"></script>
  <link rel="stylesheet" href="../../cdn/element-plus/index.css" />
  <script src="../../cdn/element-plus/index.full.min.js"></script>

  <link rel="stylesheet" href="../../../lib/index.css" />
  <script src="../../../lib/avue.js"></script>
</head>

<body>
  <div id="app">
    <el-button plain @click="showDialog"> 弹窗页面</el-button>
    <el-button plain @click="showDialog1"> 弹窗页面（带上数据）</el-button>
  </div>
</body>

</html>

<script>
  var app = Vue.createApp({
    data() {
      return {
        option: {
          submitText: '完成',
          column: [
            {
              label: "姓名",
              prop: "name",
              span: 24,
              rules: [{
                required: true,
                message: "请输入姓名",
                trigger: "blur"
              }]
            }]
        },
        form: {}
      }
    },
    methods: {
      showDialog() {
        this.$DialogForm({
          title: '弹窗页面',
          width: '70%',
          type: 'drawer',
          menuPosition: 'right',
          option: this.option,
          beforeClose: (done) => {
            this.$message.success('关闭前方法')
            done()
          },
          callback: (res) => {
            console.log(res.data);
            this.$message.success('关闭等待框')
            setTimeout(() => {
              res.done()
              setTimeout(() => {
                this.$message.success('关闭弹窗')
                res.close()
              }, 1000)
            }, 1000)
          }
        })

      },
      showDialog1() {
        this.$DialogForm({
          title: '弹窗页面（带上数据)',
          width: '50%',
          type: 'drawer',
          direction: 'top',
          data: { name: '测试数据' },
          option: this.option,
          callback: (res) => {
            console.log(res.data);
            this.$message.success('关闭等待框')
            setTimeout(() => {
              res.done()
              setTimeout(() => {
                this.$message.success('关闭弹窗')
                res.close()
              }, 1000)
            }, 1000)
          }
        })
      }
    }
  })
  app.use(ElementPlus)
  app.use(AVUE)
  app.mount('#app')
</script>